package com.nofeng.wx.controller;

import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import com.nofeng.wx.dao.entity.AppConfig;
import com.nofeng.wx.service.AppConfigService;
import com.nofeng.wx.service.MobileAppService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class IndexController {

    @Autowired
    AppConfigService appConfigService;

    @RequestMapping(value = "/index/index")
    public String index() {
        Map<String,String> map= Maps.newHashMap();
        map.put("aaa", "aaaa");
        return JSONObject.toJSONString(map);
    }

    @RequestMapping(value = "/test")
    public String test() {
       List<AppConfig> appConfigs = appConfigService.getByUserId(1L);
       return JSONObject.toJSONString(appConfigs);

    }

    @RequestMapping(value = "/rebuild")
    public String rebuild() {
        Map<String, String> executeResultMap = appConfigService.rebuild(true);
        return JSONObject.toJSONString(executeResultMap);
    }
}
